<html>
<head><meta charset="utf-8"><title>librustc_mir incremental changes · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html">librustc_mir incremental changes</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="171623878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171623878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171623878">(Jul 24 2019 at 17:07)</a>:</h4>
<p>Is it just me or did incremental changes to librustc_mir get a lot slower? I think it used to be on the order of 3-4min for a <code>./x.py build --keep-stage 0 src/rustc</code>, now it's 5min just for the compiler artifacts and 7min in total. (also since when does the LLVM backend depend on <code>rand</code>? Are we generating random code now? :D )</p>



<a name="171624344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171624344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171624344">(Jul 24 2019 at 17:13)</a>:</h4>
<p>Hashing needs <code>rand</code> I guess</p>



<a name="171625368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171625368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171625368">(Jul 24 2019 at 17:25)</a>:</h4>
<p>I think the <code>rand</code> dependency is coming from <code>cc</code> which uses <code>tempdir</code> which uses <code>rand</code>. Seems innocuous enough.</p>



<a name="171626549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171626549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171626549">(Jul 24 2019 at 17:39)</a>:</h4>
<p>yeah I also don't think <code>rand</code> is responsible for the slowdown</p>



<a name="171636528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171636528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171636528">(Jul 24 2019 at 19:43)</a>:</h4>
<p><code>thread::sleep_ms(rand::random())</code></p>



<a name="171641565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171641565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171641565">(Jul 24 2019 at 20:43)</a>:</h4>
<p><code>const _: () = thread::sleep_ms(rand::random())</code> otherwise it won't affect compiletimes</p>



<a name="171642232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171642232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171642232">(Jul 24 2019 at 20:52)</a>:</h4>
<p>Except when its part of the compiler :D</p>



<a name="171642731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171642731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> HeroicKatora <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171642731">(Jul 24 2019 at 20:58)</a>:</h4>
<p>Something that seems like it could acutally be <code>const</code> at some point:<br>
<code>const _: MaybeUninit&lt;[u8; 1 &lt;&lt; (SystemTime::now() - UNIX_EPOCH).as_secs() % 30]&gt; = MaybeUninit::zeroed()</code><br>
Borrowing idea from <code>C</code>s initial randomness, the <code>__TIME__</code> macro.</p>



<a name="171642895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171642895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171642895">(Jul 24 2019 at 21:00)</a>:</h4>
<p>That is a very bad idea</p>



<a name="171643135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171643135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171643135">(Jul 24 2019 at 21:03)</a>:</h4>
<p>Especially considering that it would make a const fn return different values at each invocation</p>



<a name="171643248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171643248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> HeroicKatora <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171643248">(Jul 24 2019 at 21:04)</a>:</h4>
<p>Similar to <code>__TIME__</code> I would expect the value to be <em>some</em> constant during compilation such as the start time.</p>



<a name="171643252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171643252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171643252">(Jul 24 2019 at 21:04)</a>:</h4>
<p>I'm fairly certain that combined with const prop you'd be able to cause UB or sth</p>



<a name="171643259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171643259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171643259">(Jul 24 2019 at 21:04)</a>:</h4>
<p>Different crates will see different values</p>



<a name="171643449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171643449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171643449">(Jul 24 2019 at 21:07)</a>:</h4>
<p>Also if you just want some constant, I propose <code>const fn random() -&gt; i32 { 4 /* chosen by fair dice roll */}</code></p>



<a name="171643543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171643543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171643543">(Jul 24 2019 at 21:08)</a>:</h4>
<p>I mean if you use <code>include_bytes!</code> on a <code>/dev/foo</code> you can already get random stuff at compile time and process that via const eval</p>



<a name="171643583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171643583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171643583">(Jul 24 2019 at 21:09)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="126931">@centril</span></p>



<a name="171643604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/librustc_mir%20incremental%20changes/near/171643604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/librustc_mir.20incremental.20changes.html#171643604">(Jul 24 2019 at 21:09)</a>:</h4>
<p>Also, we should probably edit the topic</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>